// const http = uni.$u.http;
export const api = {
	login: '/sys/user/login',
	logout: 'sys/user/logout', //退出登录
	getUserInfo: 'sys/user/info',
	refreshToken: 'sys/user/refresh', //刷新token
	updatePass: 'sys/user/updatePass', //修改密码
	/* 新——修改用户信息 */
	updateInfo: '/sys/user/updateInfo',
	register: '/sys/user/wxReg', //注册
	addAccountUser: '/sys/userDetail/insert', //新增用户
	getDictItemKeyList: '/sys/dict/getDictByItem',
	getAccountUserList: '/sys/userDetail/selectBy'
}
export const deviceapi = {
	getProTypeList: '/sys/prodType/selectBy',
	getDeviceTypeList: '/sys/deviceType/selectBy',
	addDevice: '/sys/sysDevice/insert',
	getDeviceList: '/sys/sysDevice/selectBy',
	delDevice: '/sys/sysDevice/deleteById',
	getWeightData: '/sys/device/getWeightData', //获取体脂秤7天内每天平均值
	getBP2AData: '/sys/device/getBP2AData', //获取最后一次血压数据
	getO2AData: '/sys/device/getO2AData', //获取最后一次血氧数据
	findEcgFirstPage: '/sys/device/findEcgFirstPage', //获取首页心电数据
	getEcgDetail: '/sys/device/getEcgDetail', //获取详细界面心电数据
	getWeightlist: '/sys/weight/page', //体重历史列表
	getWeightCount: '/sys/weight/tongjiQuery', //体重统计
	getBP2ACount: '/sys/BP2A/tongjiQuery',
	getBP2ACountOfTj: '/sys/BP2A/getCountOfTj',
	getBP2Alist: '/sys/BP2A/page',
	getO2list: '/sys/O2/page',
	getO2Count: '/sys/O2/tongjiQuery',
	getWeightCountByDay:'/sys/weight/findByCond'

}
// test get api
export function getAction(url, params, config = {}) {
	return http.get(url, params, {
		...config
	})
}

// test post api
export function postAction(url, params, config = {}) {
	return uni.$u.http.post(url, params, config)
}
export function setToken(refreshToken) {
	return postAction(api.refreshToken, refreshToken)
}
export function logout() {
	return postAction(api.logout)
}
export function getUserInfo() {
	return postAction(api.getUserInfo, null, {
		custom: {
			ShowLoading: false
		}
	})
}
export function getAccountUserList(userId) {
	return postAction(api.getAccountUserList, {
		userId
	})
}
export function getPreMenu() {
	return postAction(api.getPreMenu)
}
export function downCourse(csId) {
	return postAction(courseapi.downCourse + '?csId=' + csId)
}